Symbolizer   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 23
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 6

1 Function

Rating   Name   Duplication   Size   Complexity  
B generator 0 10 6
1
/**
2
 * @class Symbolizer
3
 * @name Symbolizer
4
 */
5 4
export class Symbolizer {
6 45
  symbols: string[] = []
7
8
  /**
9
   * Initialize a symbolizer.
10
   */
11
  constructor(symbols?: string) {
12 45
    if (symbols) this.symbols = symbols.split('')
13
  }
14
15
  /**
16
   * Symbol generator.
17
   */
18
  *generator(): Generator<string> {
19 30
    for (let i = 0; ; i++) {
20 75
      if (i < this.symbols.length) {
21 25
        yield this.symbols[i] ?? '?'
22
      } else {
23 50
        yield String.fromCharCode(945 + i - this.symbols.length)
24
      }
25
    }
26
  }
27
}
28
29
export default Symbolizer
30